﻿using System;
using System.IO;

using SBPweb.Modules.Modularity;

using SBPweb.MediaCenter.Common.Files;

using SBPweb.MediaCenter.Modules.Player.WPF.Controls;
using SBPweb.MediaCenter.Common.Services;

namespace SBPweb.MediaCenter.Modules.Player.WPF.Controllers
{

    public class PlayerService : PlayerServiceBase
    {

        #region Private fields

        private PlayerControl viewControl;

        #endregion

        #region Constructor logic

        public PlayerService(IModule parentModule)
            : base(parentModule)
        {
        }

        #endregion

        #region Property accessors

        public PlayerControl PlayerViewControl
        {
            get
            {
                return viewControl;
            }
            set
            {
                viewControl = value;
                InitializeView();
            }
        }

        public IUriListOpenerService ListOpener
        {
            get
            {
                return this.Module.Services.Get<IUriListOpenerService>();
            }
        }

        #endregion

        #region Methods

        public override void Open(Uri uri)
        {
            viewControl.Open(uri);
        }

        public override void Open(Stream stream)
        {
            viewControl.Open(stream);
        }

        #region Private helper methods

        private void InitializeView()
        {
            //string gef = FileUriHelper.GetExtensionsFilter(this.GetSupportedExtensions());
            //CurrentExtensionsFilter = "wmv";
            //ListOpener.Open(new Uri("C:\\Users\\Public\\Videos\\HD Samples\\AdrenalineRush.wmv", UriKind.RelativeOrAbsolute));
        }

        #endregion

        #endregion

    }

}